import { Component, OnInit, Input } from '@angular/core'
import { Widget } from '../../model'
import { JsonApiService } from '../../../../core/api/json-api.service'


@Component({
  selector: 'total-car-number',
  templateUrl: './total-car-number.html',
  styleUrls: ['./total-car-number.css']
})
// 车辆总数
export class TotalCarNumber implements OnInit, Widget {
  @Input() componentData: any
  // @Input() auth = true
  carMount = 0
  loading = false


  constructor(private jsonApiService: JsonApiService) { }
  ngOnInit() {
    this.initData()
  }

  initData() {
    this.loading = true
    this.jsonApiService.http('control/station/car/total/carTotalNum.html', null, false).subscribe(data => {
      this.loading = false
      if (data.success) {
        this.carMount = data.data;
      } else {
        this.jsonApiService.message(data.message);
      }
    })
  }
}
